#include "tcpServer.hpp"
#include "calServer.hpp"
#include "Log.hpp"
#include <iostream>
#include <memory>
#include <functional>
#include <cstdlib>
Log lg;
using namespace std;
void Usage(const std::string& cmd)
{
    cout << "\n\r" << cmd << " port[1024+]" << endl << endl; 
}
int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(1);
    }
    int port = stoi(argv[1]);
    CalServer cs;
    unique_ptr<TcpServer> tsv(new TcpServer(port, bind(&CalServer::Calculator, &cs, std::placeholders::_1)));
    tsv->InitServer();
    tsv->Run();
    return 0;
}